const defaultState={
    list:[1,2,3],
    inputValue:"初始值"
}
export default (state=defaultState,action)=>{
    const newState = JSON.parse(JSON.stringify(state));
    if(action.type==='change_input_value'){
        newState.inputValue = action.value;
    }
    if(action.type==='add_list_item'){
        newState.list = [...state.list,state.inputValue];
        newState.inputValue ="";
    }
    if(action.type==='delecte_list_item'){
       
        const list = [...state.list];
        list.splice(action.value,1);
        newState.list = list;
    }
    return newState
}